<template>
  <div class="header">
    <div class="header-left">
      <span class="icon">
        <i class="iconfont icon-topleftarror"></i>
      </span>
    </div>
    <div class="header-input">
      <i class="iconfont icon-sousuo"></i>
      输入城市/景点
    </div>
    <router-link to="/city">
    <div class="header-right">
        {{city}}
          <i class="iconfont icon-arror_down"></i>
    </div>
    </router-link>
  </div>
</template>
<script>
import {mapState} from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    //    vuex通过一个计算属性把vuex里的一个state映射到组件中的一个属性
    ...mapState(['city'])
  }
}
</script>
<style lang="stylus" scoped>
  @import "~stylus/varibles.styl"
  .header
    display :flex
    width : 100%
    height : .9rem
    line-height: .9rem
    background-color : $bgColor
    color : #ffffff
    .header-left
      width:.7rem;
      float: left;
      text-align :center
    .header-input
      line-height :.64rem
      height : .64rem
      margin:.13rem .03rem
      padding-left .05rem
      flex :1;
      background-color :#fff;
      color :#ccc;
      border-radius :.04rem;
    .header-right
      min-width : 1.28rem;
      float : right;
      color #ffffff
      height .8rem
      line-height .8rem
      .iconfont
        font-size :.45rem
</style>
